package com.zhdl.modules.demo.DCHTProcess;

import com.zhdl.modules.demo.dglProcess.Robot.RobotChildProcess;
import com.zhdl.modules.demo.dglProcess.Robot.RobotRunService;
import com.zhdl.modules.process.common.ProcessDo;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class RobotRunDo implements ProcessDo {
    RobotRunService robotRunService;
    RobotChildProcess robotChildProcess;
    public RobotRunDo(RobotRunService robotRunService, RobotChildProcess robotChildProcess) {
        this.robotRunService = robotRunService;
        this.robotChildProcess = robotChildProcess;
    }

    public RobotRunDo(RobotRunService robotRunService) {
        this.robotRunService = robotRunService;
    }

    @Override
    public void doSomeThing() {
        if (robotChildProcess == null){
            log.info(robotRunService.getClass().getName()+"机器人程序子程序流程衔接部分");
            robotRunService.robotNextStep();
        }else{
            log.info(robotRunService.getClass().getName()+"机器人主程序选择子程序"+robotChildProcess.getDesc());
            robotRunService.startChildProcess(robotChildProcess);
        }
    }
}
